/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modele;

import java.util.Collection;

/**
 *
 * @author plasalmonie
 */
public class Pays {

    private Collection<Dep> LesDep;
    private Collection<Spe> LesSpe;

    public Pays() {
        this.LesDep = DAO.getLesDeps();
        this.LesSpe = DAO.getLesSpe();
        Collection<Med> LesMed = DAO.getLesMed();
        for (Med unMed : LesMed) {
            getLeDep(unMed.getDep()).addMed(unMed);
            Spe uneSpe = getLaSpe(unMed.getSpe());
            if (uneSpe != null) {
                uneSpe.ajoutMed(unMed);
            }
        }
    }

    public Collection<Dep> getLesDep() {
        return LesDep;
    }
    
     public Collection<Spe> getLesSpe() {
        return LesSpe;
    }

    public Dep getLeDep(String numDep) {
        for (Dep unDep : LesDep) {
            if (unDep.getNum().equals(numDep)) {
                return unDep;
            }
        }
        return null;
    }

    public Spe getLaSpe(String num) {
        for (Spe uneSpe : LesSpe) {
            if (uneSpe.getNum().equals(num)) {
                return uneSpe;
            }
        }
        return null;
    }
}
